#!D:/CODE/python
# -*- coding: utf-8 -*-
# @Time : 2020/5/30 22:11
# @Author : Alexdong
# @Site : 
# @File : 新式property属性的三种方式1.py
# @Software: PyCharm
# Functional description:

class Goods():
    def __init__(self):
        # 原价
        self.original_price = 100
        # 折扣
        self.discount = 0.8

    @property
    def price(self):
        # 实际价格 =  原价 * 折扣
        return self.original_price * self.discount

    @price.setter
    def price(self, value):
        self.original_price = value

    @price.deleter
    def price(self):
        del self.original_price

obj = Goods()
print(obj.price)
obj.price = 200
print(obj.price)